package cn.tedu.kcircle.common.util;

import cn.tedu.kcircle.common.restful.JsonResult;
import com.alibaba.fastjson.JSON;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

public class CustomResponse {
    public static void sendResponse(HttpServletResponse response, JsonResult result) throws IOException {
        response.setContentType("application/json; charset=utf-8");
        String jsonString = JSON.toJSONString(result);
        PrintWriter writer = response.getWriter();
        writer.println(jsonString);
        writer.close();
    }
}
